package com.lion.common.modules.uaa.web.models.params;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import java.io.Serializable;

/**
 * @author Chris Chan
 * Create On 2025/8/8 上午11:58
 * Use for:
 * Explain:
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "手机号参数")
public class MobileParam implements Serializable {
    private static final long serialVersionUID = 1L;

    @NotBlank(message = "手机号不能为空")
    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式错误")
    @Length(min = 11, max = 20, message = "手机号长度错误,必须介于11位和20位之间")
    @Schema(description = "手机号", example = "13800000000")
    private String mobile;

    public static MobileParam of(String mobile) {
        return new MobileParam(mobile);
    }

    public static MobileParam create(String mobile) {
        return new MobileParam(mobile);
    }
}
